package com.top10.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.top10.common.DatabaseConst;
import com.top10.entity.TbCategory;
import com.top10.mapper.TbCategoryMapper;
import com.top10.service.TbCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TbCategoryServiceImpl implements TbCategoryService {
	@Autowired
	private TbCategoryMapper tbCategoryMapper;

	@Override
	public List<TbCategory> getParent()throws Exception{
		return tbCategoryMapper.selectList(new EntityWrapper<TbCategory>().eq("parentId",0).eq("isdeleted",DatabaseConst.IS_DELETED_NO));
	}
	@Override
	public List<TbCategory>getSon(Integer id)throws Exception{
		return  tbCategoryMapper.selectList(new EntityWrapper<TbCategory>().eq("parentId",id).eq("isdeleted",DatabaseConst.IS_DELETED_NO));
	}
}
